/**
 * @description 应用配置
*/

/* 运行模式配置 */
(function () {
  const origin = location.origin
  const domain = /daelui.com/.test(origin) ? '//www.daelui.com' : '//www.daelui.cn'
  // 开发环境配置
  const dev = {
    mode: 'dev',
    title: '开发模式',
    // 服务匹配规则列表
    rules: [
      {rule: 'host', url: '//127.0.0.1:3201'},
      {rule: 'server', url: '//127.0.0.1:3201'},
      {rule: 'proxy', url: '//127.0.0.1:3201'},
      {rule: 'pot', url: 'foundation'}
    ],
    // 环境域名
    domain,
    // 模块加载器
    loader: {
      path: domain + '/pool/prod/packages/@daelui/pigjs/latest/dist/system.min.js',
      registry: domain + '/pool/prod/packages.json',
      rootUrl: domain + '/pool/prod/packages'
    },
    layout: {
      rows: 4,
      cols: 4,
      isShowHead: true,
      isTabStyle: false,
      isShowSwitch: true,
      isShowRefresh: true,
      isShowScale: true
    },
    pages: []
  }

  // 生产环境配置
  const prod = {
    mode: 'prod',
    title: '生产模式',
    // 服务匹配规则列表
    rules: [
      {rule: 'host', url: origin},
      {rule: 'server', url: origin},
      {rule: 'proxy', url: origin + '/dpad/proxy'},
      {rule: 'pot', url: 'foundation'}
    ],
    // 环境域名
    domain,
    // 模块加载器
    loader: {
      path: domain + '/pool/prod/packages/@daelui/pigjs/latest/dist/system.min.js',
      registry: domain + '/pool/prod/packages.json',
      rootUrl: domain + '/pool/prod/packages'
    },
    layout: {
      rows: 4,
      cols: 4,
      isShowHead: true,
      isTabStyle: false,
      isShowSwitch: true,
      isShowRefresh: true,
      isShowScale: true
    },
    pages: []
  }

  /* 应用配置 */
  const application = {
    dev, prod,
    // 运行模式配置
    mode: {dev, prod}.prod
  }

  window.application = window.application || {}
  window.application.dpad = application
})();
